﻿using System;
using System.IO;
using System.Collections.Generic;
using System.Text;

using Obsidian.Utils;
using Obsidian.Action;
using Oak.Core;
using Oak.Core.Logic;
using Oak.Model;

namespace Oak.Core.Action
{
    public class OakActReqHandler : ActReqHandler
    {

        private ActPermissionLG actPermLG = new ActPermissionLG();

        public OakActReqHandler() : base() { }

        public OakActReqHandler(string appKey) : base(appKey) { }

        public OakActReqHandler(Stream stream) : base(stream) { }

        public OakActReqHandler(Stream stream, string appKey)
            : base(stream, appKey) { }

        protected override bool BeforeExecuteLocalRequest(ActionRequest req, out string msg)
        {
            msg = "";
            return true;


            string appKey = this.ApiInfo.AppKey;
            string actionName = req.Action;
            CoActPermissionInfo perm = actPermLG.GetPermission(appKey, actionName, out msg);
            if (perm == null)
            {
                if (StringUtil.IsNullOrWhiteSpace(msg))
                    msg = "当前AppKey无权限访问该接口";
                return false;
            }
            msg = "";
            return true;
        }


    }
}
